import { getPromptTemplateKeyWords, replacePromptTemplateKeyWords } from "./utils";

export class TextPrompt {
    constructor(public text: string) {}
    getKeyWords(): Set<string> {
        return getPromptTemplateKeyWords(this.text);
    }
    format(data?: Record<string, string>): string {
        if (!data) {
            return this.text;
        }
        return replacePromptTemplateKeyWords(this.text, data);
    }
}

export class CodePrompt extends TextPrompt {
    constructor(
        public text: string,
        public codeType: string
    ) {
        super(text);
    }
    getCodeType() {
        return this.codeType;
    }
    setCodeType(codeType: string) {
        this.codeType = codeType;
    }
}
